import { defHttp } from '/@/utils/http/axios';
import { getMenuListResultModel } from './model/menuModel';

enum Api {
  GetMenuList = '/menu/list',
  GetActiveMenu = '/menu/active',
  CreateMenu = '/menu/create',
  UpdateMenu = '/menu/update',
  DetailMenu = '/menu/detail',
  DeleteMenu = '/menu/del',
}

/**
 * @description: Get user menu based on id
 */

export const getMenuList = (params) => {
  return defHttp.get<getMenuListResultModel>({ url: Api.GetMenuList, params });
};
export const getMenuDetail = (params) => {
  return defHttp.get<getMenuListResultModel>({ url: Api.DetailMenu, params });
};

export const getActiveMenu = () => {
  return defHttp.get<getMenuListResultModel>({ url: Api.GetActiveMenu });
};
export const createMenu = (data) => {
  return defHttp.post<getMenuListResultModel>({ url: Api.CreateMenu, data });
};
export const updateMenu = (data) => {
  return defHttp.post<getMenuListResultModel>({ url: Api.UpdateMenu, data });
};
export const deleteMenu = (data) => {
  return defHttp.post<getMenuListResultModel>({ url: Api.DeleteMenu, data });
};
